﻿using System;
using Messhall.Framework.Autofac;
using Messhall.Framework.Domain.DomainObject;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace Messhall.Framework.Domain.Repository
{
    public interface IRepositoryBase<BoT, TEntity> : IRepositoryReadBase<BoT, TEntity>
        where BoT : BoBase
        where TEntity : EntityBase
    {
        /// <summary>
        /// 把一个新建的业务对象交给Repository管理
        /// </summary>
        /// <param name="item">新建的业务对象</param>
        Task AddAsync(BoT item);

        /// <summary>
        /// 把指定的业务对象从repository中删除
        /// </summary>
        /// <param name="item">需要被删除的业务对象</param>
        Task RemoveAsync(BoT item);

        /// <summary>
        /// 把指定业务对象从repository软删除
        /// </summary>
        /// <param name="keyIds"></param>
        /// <returns></returns>
        Task DeleteAsync(params Guid[] keyIds);


        /// <summary>
        /// 把指定业务对象从repository软删除
        /// </summary>
        /// <param name="fliter"></param>
        /// <returns></returns>
        Task DeleteAsync(Expression<Func<TEntity, bool>> fliter);

        /// <summary>
        /// 把指定的业务对象从repository中更新
        /// </summary>
        /// <param name="item"></param>
        Task UpdateAsync(BoT item);
    }
}